import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/application/preventive_rectification_get_entity.dart';

PreventiveRectificationGetEntity $PreventiveRectificationGetEntityFromJson(Map<String, dynamic> json) {
  final PreventiveRectificationGetEntity preventiveRectificationGetEntity = PreventiveRectificationGetEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    preventiveRectificationGetEntity.id = id;
  }
  final String? preventiveName = jsonConvert.convert<String>(json['preventiveName']);
  if (preventiveName != null) {
    preventiveRectificationGetEntity.preventiveName = preventiveName;
  }
  final int? companyId = jsonConvert.convert<int>(json['companyId']);
  if (companyId != null) {
    preventiveRectificationGetEntity.companyId = companyId;
  }
  final String? companyName = jsonConvert.convert<String>(json['companyName']);
  if (companyName != null) {
    preventiveRectificationGetEntity.companyName = companyName;
  }
  final int? findTime = jsonConvert.convert<int>(json['findTime']);
  if (findTime != null) {
    preventiveRectificationGetEntity.findTime = findTime;
  }
  final int? rectificationDeadline = jsonConvert.convert<int>(json['rectificationDeadline']);
  if (rectificationDeadline != null) {
    preventiveRectificationGetEntity.rectificationDeadline = rectificationDeadline;
  }
  final dynamic uploaderId = json['uploaderId'];
  if (uploaderId != null) {
    preventiveRectificationGetEntity.uploaderId = uploaderId;
  }
  final dynamic uploaderName = json['uploaderName'];
  if (uploaderName != null) {
    preventiveRectificationGetEntity.uploaderName = uploaderName;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    preventiveRectificationGetEntity.status = status;
  }
  final int? canClick = jsonConvert.convert<int>(json['canClick']);
  if (canClick != null) {
    preventiveRectificationGetEntity.canClick = canClick;
  }
  final int? fenCompanyApproveStatus = jsonConvert.convert<int>(json['fenCompanyApproveStatus']);
  if (fenCompanyApproveStatus != null) {
    preventiveRectificationGetEntity.fenCompanyApproveStatus = fenCompanyApproveStatus;
  }
  final String? creator = jsonConvert.convert<String>(json['creator']);
  if (creator != null) {
    preventiveRectificationGetEntity.creator = creator;
  }
  final String? rectificationRequire = jsonConvert.convert<String>(json['rectificationRequire']);
  if (rectificationRequire != null) {
    preventiveRectificationGetEntity.rectificationRequire = rectificationRequire;
  }
  final String? source = jsonConvert.convert<String>(json['source']);
  if (source != null) {
    preventiveRectificationGetEntity.source = source;
  }
  final String? problemDesc = jsonConvert.convert<String>(json['problemDesc']);
  if (problemDesc != null) {
    preventiveRectificationGetEntity.problemDesc = problemDesc;
  }
  final String? fileUrl = jsonConvert.convert<String>(json['fileUrl']);
  if (fileUrl != null) {
    preventiveRectificationGetEntity.fileUrl = fileUrl;
  }
  final dynamic acceptanceStatus = json['acceptanceStatus'];
  if (acceptanceStatus != null) {
    preventiveRectificationGetEntity.acceptanceStatus = acceptanceStatus;
  }
  final String? acceptanceDesc = jsonConvert.convert<String>(json['acceptanceDesc']);
  if (acceptanceDesc != null) {
    preventiveRectificationGetEntity.acceptanceDesc = acceptanceDesc;
  }
  final String? acceptanceFileUrl = jsonConvert.convert<String>(json['acceptanceFileUrl']);
  if (acceptanceFileUrl != null) {
    preventiveRectificationGetEntity.acceptanceFileUrl = acceptanceFileUrl;
  }
  final int? createTime = jsonConvert.convert<int>(json['createTime']);
  if (createTime != null) {
    preventiveRectificationGetEntity.createTime = createTime;
  }
  final int? approvalTime = jsonConvert.convert<int>(json['approvalTime']);
  if (approvalTime != null) {
    preventiveRectificationGetEntity.approvalTime = approvalTime;
  }
  final String? rectificationPersonName = jsonConvert.convert<String>(json['rectificationPersonName']);
  if (rectificationPersonName != null) {
    preventiveRectificationGetEntity.rectificationPersonName = rectificationPersonName;
  }
  final int? rectificationPersonId = jsonConvert.convert<int>(json['rectificationPersonId']);
  if (rectificationPersonId != null) {
    preventiveRectificationGetEntity.rectificationPersonId = rectificationPersonId;
  }
  final String? deptNames = jsonConvert.convert<String>(json['deptNames']);
  if (deptNames != null) {
    preventiveRectificationGetEntity.deptNames = deptNames;
  }
  final String? deptIds = jsonConvert.convert<String>(json['deptIds']);
  if (deptIds != null) {
    preventiveRectificationGetEntity.deptIds = deptIds;
  }
  final String? responsibleUserNames = jsonConvert.convert<String>(json['responsibleUserNames']);
  if (responsibleUserNames != null) {
    preventiveRectificationGetEntity.responsibleUserNames = responsibleUserNames;
  }
  final String? responsibleUsers = jsonConvert.convert<String>(json['responsibleUsers']);
  if (responsibleUsers != null) {
    preventiveRectificationGetEntity.responsibleUsers = responsibleUsers;
  }
  final String? rectificationDeptIds = jsonConvert.convert<String>(json['rectificationDeptIds']);
  if (rectificationDeptIds != null) {
    preventiveRectificationGetEntity.rectificationDeptIds = rectificationDeptIds;
  }
  final String? rectificationDeptNames = jsonConvert.convert<String>(json['rectificationDeptNames']);
  if (rectificationDeptNames != null) {
    preventiveRectificationGetEntity.rectificationDeptNames = rectificationDeptNames;
  }
  final String? rectificationUserIds = jsonConvert.convert<String>(json['rectificationUserIds']);
  if (rectificationUserIds != null) {
    preventiveRectificationGetEntity.rectificationUserIds = rectificationUserIds;
  }
  final String? rectificationUserNames = jsonConvert.convert<String>(json['rectificationUserNames']);
  if (rectificationUserNames != null) {
    preventiveRectificationGetEntity.rectificationUserNames = rectificationUserNames;
  }
  final List<PreventiveRectificationGetRecordDOS>? recordDOS = (json['recordDOS'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<PreventiveRectificationGetRecordDOS>(e) as PreventiveRectificationGetRecordDOS).toList();
  if (recordDOS != null) {
    preventiveRectificationGetEntity.recordDOS = recordDOS;
  }
  return preventiveRectificationGetEntity;
}

Map<String, dynamic> $PreventiveRectificationGetEntityToJson(PreventiveRectificationGetEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['preventiveName'] = entity.preventiveName;
  data['companyId'] = entity.companyId;
  data['companyName'] = entity.companyName;
  data['findTime'] = entity.findTime;
  data['rectificationDeadline'] = entity.rectificationDeadline;
  data['uploaderId'] = entity.uploaderId;
  data['uploaderName'] = entity.uploaderName;
  data['status'] = entity.status;
  data['canClick'] = entity.canClick;
  data['fenCompanyApproveStatus'] = entity.fenCompanyApproveStatus;
  data['creator'] = entity.creator;
  data['rectificationRequire'] = entity.rectificationRequire;
  data['source'] = entity.source;
  data['problemDesc'] = entity.problemDesc;
  data['fileUrl'] = entity.fileUrl;
  data['acceptanceStatus'] = entity.acceptanceStatus;
  data['acceptanceDesc'] = entity.acceptanceDesc;
  data['acceptanceFileUrl'] = entity.acceptanceFileUrl;
  data['createTime'] = entity.createTime;
  data['approvalTime'] = entity.approvalTime;
  data['rectificationPersonName'] = entity.rectificationPersonName;
  data['rectificationPersonId'] = entity.rectificationPersonId;
  data['deptNames'] = entity.deptNames;
  data['deptIds'] = entity.deptIds;
  data['responsibleUserNames'] = entity.responsibleUserNames;
  data['responsibleUsers'] = entity.responsibleUsers;
  data['rectificationDeptIds'] = entity.rectificationDeptIds;
  data['rectificationDeptNames'] = entity.rectificationDeptNames;
  data['rectificationUserIds'] = entity.rectificationUserIds;
  data['rectificationUserNames'] = entity.rectificationUserNames;
  data['recordDOS'] = entity.recordDOS.map((v) => v.toJson()).toList();
  return data;
}

extension PreventiveRectificationGetEntityExtension on PreventiveRectificationGetEntity {
  PreventiveRectificationGetEntity copyWith({
    int? id,
    String? preventiveName,
    int? companyId,
    String? companyName,
    int? findTime,
    int? rectificationDeadline,
    dynamic uploaderId,
    dynamic uploaderName,
    int? status,
    int? canClick,
    int? fenCompanyApproveStatus,
    String? creator,
    String? rectificationRequire,
    String? source,
    String? problemDesc,
    String? fileUrl,
    dynamic acceptanceStatus,
    String? acceptanceDesc,
    String? acceptanceFileUrl,
    int? createTime,
    int? approvalTime,
    String? rectificationPersonName,
    int? rectificationPersonId,
    String? deptNames,
    String? deptIds,
    String? responsibleUserNames,
    String? responsibleUsers,
    String? rectificationDeptIds,
    String? rectificationDeptNames,
    String? rectificationUserIds,
    String? rectificationUserNames,
    List<PreventiveRectificationGetRecordDOS>? recordDOS,
  }) {
    return PreventiveRectificationGetEntity()
      ..id = id ?? this.id
      ..preventiveName = preventiveName ?? this.preventiveName
      ..companyId = companyId ?? this.companyId
      ..companyName = companyName ?? this.companyName
      ..findTime = findTime ?? this.findTime
      ..rectificationDeadline = rectificationDeadline ?? this.rectificationDeadline
      ..uploaderId = uploaderId ?? this.uploaderId
      ..uploaderName = uploaderName ?? this.uploaderName
      ..status = status ?? this.status
      ..canClick = canClick ?? this.canClick
      ..fenCompanyApproveStatus = fenCompanyApproveStatus ?? this.fenCompanyApproveStatus
      ..creator = creator ?? this.creator
      ..rectificationRequire = rectificationRequire ?? this.rectificationRequire
      ..source = source ?? this.source
      ..problemDesc = problemDesc ?? this.problemDesc
      ..fileUrl = fileUrl ?? this.fileUrl
      ..acceptanceStatus = acceptanceStatus ?? this.acceptanceStatus
      ..acceptanceDesc = acceptanceDesc ?? this.acceptanceDesc
      ..acceptanceFileUrl = acceptanceFileUrl ?? this.acceptanceFileUrl
      ..createTime = createTime ?? this.createTime
      ..approvalTime = approvalTime ?? this.approvalTime
      ..rectificationPersonName = rectificationPersonName ?? this.rectificationPersonName
      ..rectificationPersonId = rectificationPersonId ?? this.rectificationPersonId
      ..deptNames = deptNames ?? this.deptNames
      ..deptIds = deptIds ?? this.deptIds
      ..responsibleUserNames = responsibleUserNames ?? this.responsibleUserNames
      ..responsibleUsers = responsibleUsers ?? this.responsibleUsers
      ..rectificationDeptIds = rectificationDeptIds ?? this.rectificationDeptIds
      ..rectificationDeptNames = rectificationDeptNames ?? this.rectificationDeptNames
      ..rectificationUserIds = rectificationUserIds ?? this.rectificationUserIds
      ..rectificationUserNames = rectificationUserNames ?? this.rectificationUserNames
      ..recordDOS = recordDOS ?? this.recordDOS;
  }
}

PreventiveRectificationGetRecordDOS $PreventiveRectificationGetRecordDOSFromJson(Map<String, dynamic> json) {
  final PreventiveRectificationGetRecordDOS preventiveRectificationGetRecordDOS = PreventiveRectificationGetRecordDOS();
  final int? createTime = jsonConvert.convert<int>(json['createTime']);
  if (createTime != null) {
    preventiveRectificationGetRecordDOS.createTime = createTime;
  }
  final int? updateTime = jsonConvert.convert<int>(json['updateTime']);
  if (updateTime != null) {
    preventiveRectificationGetRecordDOS.updateTime = updateTime;
  }
  final String? creator = jsonConvert.convert<String>(json['creator']);
  if (creator != null) {
    preventiveRectificationGetRecordDOS.creator = creator;
  }
  final String? updater = jsonConvert.convert<String>(json['updater']);
  if (updater != null) {
    preventiveRectificationGetRecordDOS.updater = updater;
  }
  final bool? deleted = jsonConvert.convert<bool>(json['deleted']);
  if (deleted != null) {
    preventiveRectificationGetRecordDOS.deleted = deleted;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    preventiveRectificationGetRecordDOS.id = id;
  }
  final int? preventiveId = jsonConvert.convert<int>(json['preventiveId']);
  if (preventiveId != null) {
    preventiveRectificationGetRecordDOS.preventiveId = preventiveId;
  }
  final dynamic companyId = json['companyId'];
  if (companyId != null) {
    preventiveRectificationGetRecordDOS.companyId = companyId;
  }
  final dynamic rectificationPersonId = json['rectificationPersonId'];
  if (rectificationPersonId != null) {
    preventiveRectificationGetRecordDOS.rectificationPersonId = rectificationPersonId;
  }
  final String? rectificationPersonName = jsonConvert.convert<String>(json['rectificationPersonName']);
  if (rectificationPersonName != null) {
    preventiveRectificationGetRecordDOS.rectificationPersonName = rectificationPersonName;
  }
  final int? rectificationTime = jsonConvert.convert<int>(json['rectificationTime']);
  if (rectificationTime != null) {
    preventiveRectificationGetRecordDOS.rectificationTime = rectificationTime;
  }
  final String? rectificationProgress = jsonConvert.convert<String>(json['rectificationProgress']);
  if (rectificationProgress != null) {
    preventiveRectificationGetRecordDOS.rectificationProgress = rectificationProgress;
  }
  final String? rectificationActions = jsonConvert.convert<String>(json['rectificationActions']);
  if (rectificationActions != null) {
    preventiveRectificationGetRecordDOS.rectificationActions = rectificationActions;
  }
  final String? rectificationDesc = jsonConvert.convert<String>(json['rectificationDesc']);
  if (rectificationDesc != null) {
    preventiveRectificationGetRecordDOS.rectificationDesc = rectificationDesc;
  }
  final String? rectificationFile = jsonConvert.convert<String>(json['rectificationFile']);
  if (rectificationFile != null) {
    preventiveRectificationGetRecordDOS.rectificationFile = rectificationFile;
  }
  return preventiveRectificationGetRecordDOS;
}

Map<String, dynamic> $PreventiveRectificationGetRecordDOSToJson(PreventiveRectificationGetRecordDOS entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createTime'] = entity.createTime;
  data['updateTime'] = entity.updateTime;
  data['creator'] = entity.creator;
  data['updater'] = entity.updater;
  data['deleted'] = entity.deleted;
  data['id'] = entity.id;
  data['preventiveId'] = entity.preventiveId;
  data['companyId'] = entity.companyId;
  data['rectificationPersonId'] = entity.rectificationPersonId;
  data['rectificationPersonName'] = entity.rectificationPersonName;
  data['rectificationTime'] = entity.rectificationTime;
  data['rectificationProgress'] = entity.rectificationProgress;
  data['rectificationActions'] = entity.rectificationActions;
  data['rectificationDesc'] = entity.rectificationDesc;
  data['rectificationFile'] = entity.rectificationFile;
  return data;
}

extension PreventiveRectificationGetRecordDOSExtension on PreventiveRectificationGetRecordDOS {
  PreventiveRectificationGetRecordDOS copyWith({
    int? createTime,
    int? updateTime,
    String? creator,
    String? updater,
    bool? deleted,
    int? id,
    int? preventiveId,
    dynamic companyId,
    dynamic rectificationPersonId,
    String? rectificationPersonName,
    int? rectificationTime,
    String? rectificationProgress,
    String? rectificationActions,
    String? rectificationDesc,
    String? rectificationFile,
  }) {
    return PreventiveRectificationGetRecordDOS()
      ..createTime = createTime ?? this.createTime
      ..updateTime = updateTime ?? this.updateTime
      ..creator = creator ?? this.creator
      ..updater = updater ?? this.updater
      ..deleted = deleted ?? this.deleted
      ..id = id ?? this.id
      ..preventiveId = preventiveId ?? this.preventiveId
      ..companyId = companyId ?? this.companyId
      ..rectificationPersonId = rectificationPersonId ?? this.rectificationPersonId
      ..rectificationPersonName = rectificationPersonName ?? this.rectificationPersonName
      ..rectificationTime = rectificationTime ?? this.rectificationTime
      ..rectificationProgress = rectificationProgress ?? this.rectificationProgress
      ..rectificationActions = rectificationActions ?? this.rectificationActions
      ..rectificationDesc = rectificationDesc ?? this.rectificationDesc
      ..rectificationFile = rectificationFile ?? this.rectificationFile;
  }
}